
OBJS := itemx.o


ROM := fe8n4.gba

CC := E:/msys2/home/yami/src/mamedev/devkitARM-r54-3-win32.pkg.tar/devkitARM-r54-3-win32.pkg/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc
OBJCOPY := E:/msys2/home/yami/src/mamedev/devkitARM-r54-3-win32.pkg.tar/devkitARM-r54-3-win32.pkg/opt/devkitpro/devkitARM/bin/arm-none-eabi-objcopy
OBJDUMP := E:/msys2/home/yami/src/mamedev/devkitARM-r54-3-win32.pkg.tar/devkitARM-r54-3-win32.pkg/opt/devkitpro/devkitARM/bin/arm-none-eabi-objdump

ifdef WRITE
include JMP.make
endif

elf:$(OBJS)
	$(CC) $(^) -o hack.elf -nostdlib -Thack.ld
	$(OBJCOPY) hack.elf -O binary hack.bin
	set objdump=$(OBJDUMP)
	lua dumpj.lua JMP.make
	make -C . write WRITE=1

write:build_jmp
	lua write.lua 0x09000000 hack.bin $(ROM)

%.o:%.s
	$(CC) -c $(<) -o $(@)

%.o:%.c
	$(CC) -c $(<) -o $(@) -mthumb -O2
